﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WoWAPI
{
	public class Item
	{
		private const string ITEM_URL = "http://{0}.battle.net/api/wow/data/item/{1}";

		#region Properties
		public int ID { get; set; }
		public string Name { get; set; }
		public string Icon { get; set; }
		public int Quality { get; set; }
		public ItemTooltipParams TooltipParams { get; set; }

		//Item API (not done yet? seemed incomplete in the documentation, and it threw a 500 when I tested the endpoint)
		//public int DisenchantingSkillRank { get; set; }
		//public string Description { get; set; }
		//public int Stackable { get; set; }
		//public ItemBindData ItemBind { get; set; }
		//public 
		#endregion

		public Item() { }

		public static Item GetItem(int ItemID, string Region)
		{
			return API.DeserializeJSON<Item>(API.MakeWebRequest(String.Format(ITEM_URL, Region, ItemID)));
		}

		#region Sub Classes
		public class ItemTooltipParams
		{
			public int? Gem0 { get; set; }
			public int? Gem1 { get; set; }
			public int? Gem2 { get; set; }
			public int? Enchant { get; set; }
			public int[] Set { get; set; }
			public bool ExtraSocket { get; set; }

			public ItemTooltipParams() { }
		}

		public class ItemBindData
		{
			public int ID { get; set; }

			public ItemBindData() { }
		}
		#endregion
	}
}
